package com.control.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.events.MyEvent;
	import com.model.ModelLocator;

	public class MyEventCommand implements ICommand 
	{
		private var _model:ModelLocator;
		public function MyEventCommand()
		{
			_model = ModelLocator.getInstance();
		}
		
		public function execute(evt:CairngormEvent):void
		{
			var myEvt:MyEvent = evt as MyEvent;
			switch(myEvt.eventType)
			{
				case MyEvent.INIT:
					_model.paiMaker.init(myEvt.value.source, myEvt.value.lrc);
					break;
				case MyEvent.PLAY:
					_model.paiMaker.play();
					break;
				case MyEvent.STOP:
					_model.paiMaker.stop();
					_model.paiMaker.videoPlayer.stop();
					_model.paiMaker.timeline.stop();
					break;
				case MyEvent.PAUSE:
					_model.paiMaker.pause();
					break;
			}
		}
	}
}